{extend name='common@layout/seller' /}
{block name="left"}{include file='goods/left'}{/block}
{block name="breadcrumb"}
<div class="ncsc-path"><i class="icon-desktop"></i>商家管理中心<i class="icon-angle-right"></i>商品<i class="icon-angle-right"></i>图片空间</div>
{/block}
{block name='content'}
<div class="tabmenu">
    <ul class="tab pngFix">
        <li class="active"><a  href="{:url('seller/album/index')}">我的相册</a></li>
        <!--to do<li class="normal"><a  href="index.php?act=store_album&op=store_watermark">水印管理</a></li>-->
    </ul>
    <a uri="{:url('seller/album/modify')}" nc_type="dialog" dialog_title="创建相册" class="ncsc-btn ncsc-btn-green" style="right: 100px;"><i class="icon-folder-open "></i>创建相册</a>
    <a id="open_uploader" href="JavaScript:void(0);" class="ncsc-btn ncsc-btn-acidblue"><i class="icon-cloud-upload"></i>上传图片</a>
    <div class="upload-con" id="uploader" style="display: none;">
        <form method="post" action="" id="fileupload" enctype="multipart/form-data">
            <div class="upload-con-div">选择相册：        
                <select name="category_id" id="category_id" class="select w80">
                    {foreach $lists as $one}
                    <option value='{$one.aclass_id}' class="w80">{$one.aclass_name}</option>
                    {/foreach}
                </select>
            </div>
            <div class="upload-con-div">选择文件：
                <div class="ncsc-upload-btn"> <a href="javascript:void(0);"><span>
                            <input type="file" hidefocus="true" size="1" class="input-file" name="file" multiple="multiple"/>
                        </span>
                        <p><i class="icon-upload-alt"></i>上传图片</p>
                    </a> </div>
            </div>
            <div nctype="file_msg"></div>
            <div class="upload-pmgressbar" nctype="file_loading"></div>
            <div class="upload-txt"><span>支持Jpg、Gif、Png格式，大小不超过1024KB的图片上传；浏览文件时可以按住ctrl或shift键多选。</span> </div>
        </form>
    </div>
</div>
<div id="pictureIndex" class="ncsc-picture-folder">
    <table class="search-form">
        <tbody>
            <tr>
                <td>&nbsp;</td>
                <th>排序方式</th>
                <td class="w100">
                    <form name="select_sort" id="select_sort" class="sortord" action="/">
                        <input type="hidden" name="s" value="seller/album/index" />
                        <select  name="sort" id="img_sort">
                            <option value="4" >按排序从大到小</option>
                            <option value="5" {eq name='sort' value='5'}selected{/eq}>按排序从小到大</option>
                            <option value="0" {eq name='sort' value='0'}selected{/eq}>按创建时间从晚到早</option>
                            <option value="1" {eq name='sort' value='1'}selected{/eq}>按创建时间从早到晚</option>
                            <option value="2" {eq name='sort' value='2'}selected{/eq}>按相册名降序</option>
                            <option value="3" {eq name='sort' value='3'}selected{/eq}>按相册名升序</option>
                        </select>
                    </form></td>
            </tr>
        </tbody>
    </table>
    <div class="ncsc-album">
        <ul>
            {foreach $lists as $one}
            <li class="hidden">
                <dl>
                    <dt>
                        <div class="covers">
                            <a href="{:url('seller/album/pic_list?id='.$one['aclass_id'])}">
                                {empty name='one.aclass_cover'}
                                <i class="icon-camera-retro"></i>
                                {else/}
                                <img alt="{$one.aclass_name}" id="aclass_cover" src="{$one.aclass_cover|img_url=360}">
                                {/empty}
                            </a>
                        </div>
                        <h3 class="title"><a href="{:url('seller/album/pics?id='.$one['aclass_id'])}">{$one.aclass_name}</a></h3>
                    </dt>
                    <!--to do 显示图片数量<dd class="date">共32张</dd>-->
                    <dd class="buttons">
                        <span nc_type="dialog" dialog_title="编辑相册" dialog_id='album_{$one.aclass_id}' dialog_width="480" uri="{:url('seller/album/modify?id='.$one['aclass_id'])}">
                            <a href="JavaScript:void(0);"><i class="icon-pencil"></i>编辑</a>
                        </span>
                        <!-- to do 删除相册
                        {neq name='one.is_default' value='1'}
                        <a href="javascript:void(0)" onclick="ajax_get_confirm('删除相册?\n注意：相册内的图片将转移到默认相册', '');"><i class="icon-remove-sign"></i>删除</a>
                        {/neq}
                        -->
                    </dd>
                </dl>
            </li>
            {/foreach}
        </ul>
    </div>
</div>
<script type="text/javascript" src="/old/data/resource/js/fileupload/jquery.iframe-transport.js?v1.2" charset="utf-8"></script>
<script type="text/javascript" src="/old/data/resource/js/fileupload/jquery.ui.widget.js?v1.2" charset="utf-8"></script>
<script type="text/javascript" src="/old/data/resource/js/fileupload/jquery.fileupload.js?v1.2" charset="utf-8"></script>
<script type="text/javascript">

                            $(function () {
                                $(".ncsc-album ul li").hover(function () {
                                    $(this).addClass("hover");
                                }, function () {
                                    $(this).removeClass("hover");
                                });
                                $(".ncsc-album > ul > li").jfade({
                                    start_opacity: "1",
                                    high_opacity: "1",
                                    low_opacity: ".5",
                                    timing: "200"
                                });

                                var upload_num = 0;
                                $('#fileupload').fileupload({
                                    dataType: 'json',
                                    url: '/?s=seller/album/image_upload',
                                    add: function (e, data) {
                                        $.each(data.files, function (index, file) {
                                            $('<div nctype=' + file.name.replace(/\./g, '_') + '><p>' + file.name + '</p><p class="loading"></p></div>').appendTo('div[nctype="file_loading"]');
                                        });
                                        data.submit();
                                    },
                                    done: function (e, data) {
                                        var param = data.result;
                                        $this = $('div[nctype="' + param.origin_file_name.replace(/\./g, '_') + '"]');
                                        $this.fadeOut(3000, function () {
                                            $(this).remove();
                                            if ($('div[nctype="file_loading"]').html() == '') {
                                                setTimeout("window.location.reload()", 1000);
                                            }
                                        });
                                        if (param.state == 'true') {
                                            upload_num++;
                                            $('div[nctype="file_msg"]').html('<i class="icon-ok-sign">' + '</i>' + '成功上传' + upload_num + '张图片');

                                        } else {
                                            $this.find('.loading').html(param.message).removeClass('loading');
                                        }
                                    }
                                });

                            });

                            $(function () {
                                $("#img_sort").change(function () {
                                    $('#select_sort').submit();
                                });
                            });
</script>
{/block}